package com.sunyard.dal.dto;

import com.sunyard.utils.manage.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * 预警信息查询返回实体
 */

@ApiModel
public class WarningInfoDTO {

    @ApiModelProperty(value = "机构编号")
    private String orgId;

    @ApiModelProperty(value = "机构名称")
    private String orgName;

    @ApiModelProperty(value = "最后上传时间")
    private String lastTime;

    public String getOrgId() {
        return orgId;
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public String getLastTime() {
        if (lastTime != null && !"".equals(lastTime)) {
            if ("0".equals(lastTime)) {
                return "从未上传";
            } else {
                Long timestamp = Long.parseLong(lastTime);
                String date = new SimpleDateFormat(DateUtil.YYYYMMDD_HHMMSS, Locale.CHINA).format(new Date(timestamp));
                return date;
            }
        } else {
            return "";
        }
    }

    public void setLastTime(String lastTime) {
        this.lastTime = lastTime;
    }
}
